<template>
	

	<view class="content an-index pB50">
		<!-- <view style="background: #efeff4;margin-bottom: 25px;"></view> -->
		<view class="pT10">	
			<view class="details-message" >			
				
				<p class="bold pB5">邀请人信息</p>
				<view>
					<div class="pT10 jin bg_white pB10">
						<div class="jin-frist">
							<image style="width: 100%;border-radius: 100%; height: 100%; bobackground-color: #eeeeee;" mode="aspectFill" :src="userSrcnews | personimg" @error="imageError"></image>
						</div>
					</div>
				</view>
				<view class="details-message-number">邀请公司：{{ address }}</view>				
				<view class="details-message-sex" >邀请部门：{{ appointmentinfo.dept_name }}</view>
				<view class="details-message-sex" >邀请人员：{{ company }}</view>
				<view class="details-message-phone">手机号码：{{ mobile }}</view>
				<view class="details-message-name">到访开始：{{visittime}}</view>
				<view class="details-message-name">到访结束：{{visittime2}}</view>
				<view class="details-message-name" v-if="appointmentinfo.appointment_details.carnumber && appointmentinfo.appointment_details.m_status !=0 && isloginstate && !mycontrolchanger">车牌号码：{{appointmentinfo.appointment_details.carnumber}}</view>
				<view class="details-message-name flex" v-if="!appointmentinfo.appointment_details.carnumber&appointmentinfo.appointment_details.m_status==0 & isloginstate &!mycontrolchanger">
					
						<text class="title">车牌号码：</text>
						<div class="uni-textarea tab w70" >
						
						 <div class="radioall"  v-if="isloginstate&!mycontrolchanger">
							<label class="radio" @click="chooseradio('1')"><radio value="r1"  :checked="radiostate==='1'" />没有</label>
							<label class="radio mL10" @click="chooseradio('2')"><radio value="r2"  :checked="radiostate==='2'" />有</label>
							<div class="w50 inline-block vm pL5" v-if="radiostate==='2'">

								<input type="text" class="f14 pL5 fangcarnumbers"  name='fangcarnumbers 'v-model="carnumber"  placeholder="请填写车牌号码" />

								<!-- <m-input  type="text" class="f14"  clearable v-model="carnumber"  placeholder="请填写车牌号码" ></m-input> -->
							</div>	
							
						</div>
						</div>	
				</view>
				
				<view class="details-message-sex" >邀请原由：{{ reson }}</view>
				
				<p class="bold pB5 pT10"  v-if="userinfodata|| appointmentinfo.visit_name">访客信息</p>
				<view class="details-message-number" v-if="appointmentinfo.visit_name">访客姓名：{{appointmentinfo.visit_name}}</view>
				
				<view class="details-message-number" v-if="!appointmentinfo.visit_name">访客姓名：{{userinfodata.name}}</view>
				<view class="details-message-number" v-if="!appointmentinfo.visit_name">访客性别：{{userinfodata.sex==1?'男':'女'}}</view>
				<view class="details-message-number" v-if="!appointmentinfo.visit_name">身份证号：{{userinfodata.identitycard | isidcard}}</view>
				<view class="details-message-number" v-if="!appointmentinfo.visit_name">手机号码：{{userinfodata.mobile}}</view>
				
				
				<p class="bold pB5 pT10" v-if="time_streamlist.length != 0">邀请动态</p>
				<view class="details-message-number" v-if="controlchanger && time_streamlist.length != 0" >到访状态：{{appointmentinfo.appointment_details.m_tips}}</view>
				<view class="details-message-number statusInformation" v-if="controlchanger && time_streamlist.length != 0" style="padding-top:12rpx">
					<div  v-if="time_streamlist.length != 0">
						<div class="status-information pB5 flex" v-for="item in time_streamlist" :class="item.type=='2'?'statusEND':''" v-if="item.tips=='提交时间' || item.tips=='受访人员' || item.tips=='访客确认' || item.tips=='访客姓名' || item.tips=='取消原因' || item.tips=='查看时间'">
							<div class="left">{{item.tips}}：</div>	
							<div class="right">{{item.value}}</div>
						</div>
					</div>	
				</view>
				<p class="bold pB5 pT10" v-if="time_streamlist[7]">来访动态</p>
				<!-- <view class="details-message-number" v-if="time_streamlist[7].tips=='保安扫码' || time_streamlist[6].tips=='保安扫码'" >到访状态：{{appointmentinfo.appointment_details.m_tips}}</view> -->
				<view class="details-message-number statusInformation" v-if="time_streamlist[6]">
					<div  v-if="time_streamlist.length != 0">
						<div class="status-information pB5 flex" v-for="item in time_streamlist" :class="item.type=='2'?'statusEND':''" v-if="item.tips=='保安扫码' || item.tips=='保安人员' || item.tips=='确认离开' ||item.tips=='取消进入' || item.tips=='取消缘由'">
							<div class="left">{{item.tips}}：</div>	
							<div class="right">{{item.value}}</div>
						</div>
					</div>	
				</view>
								
					<p class="bold pB5 pT10" v-if="appointmentinfo.appointment_details.healthy_img">点击查看该访客粤康码图片</p>
					<view class="details-message-number"  style="padding: 7px;" v-if="appointmentinfo.appointment_details.healthy_img">									
							<view class="user-imgshow" @click="previewImg(appointmentinfo.appointment_details.healthy_img)">
								<image  :src="appointmentinfo.appointment_details.healthy_img" style="width: 200upx; height: 200upx; background-color:  #ebebeb;"/>
							</view>
					</view>
					<p class="bold pB5 pT10" v-if="time_streamlist[10]">到访动态</p>
					<!-- <view class="details-message-number" v-if="time_streamlist[10]" >到访状态：{{appointmentinfo.appointment_details.m_tips}}</view> -->
					<view class="details-message-number statusInformation" v-if="time_streamlist[10]">
						<div  v-if="time_streamlist.length != 0">
							<div class="status-information pB5 flex" v-for="item in time_streamlist" :class="item.type=='2'?'statusEND':''" v-if="item.tips=='扫码接待' || item.tips=='接待人员' || item.tips=='接待完成' ">
								<div class="left">{{item.tips}}：</div>	
								<div class="right">{{item.value}}</div>
							</div>
						</div>	
					</view>
				
			</view>	
			
		</view>
		<view class="pT10" v-if="!isloginstate">
				<p class="f16 tCenter">{{!subscribe ? '请注册个人信息，以便接受邀请！':'尚未关注公众号'}}</p>
		</view>
			
		<view class="second pB10" style="margin-top:20px;" v-if="isloginstate&&!mycontrolchanger">
			<view class="an-index-grid" v-if="!controlchanger">
				<view class="an-index-box box-color3" :class="{control:controlchanger}"  @click="demo.submitadds" v-if="beoverdue== true">
					<div class='an-head-tile'>
						<div class='title'>接受</div>
					</div>
				</view>
				<view class="an-index-box box-color2" :class="{control:controlchanger}" @click="demo.submitmodify" >
					<div class='an-head-tile'>
						<div class='title' >修改</div>
					</div>
				</view>
				<view class="an-index-box box-color1" :class="{control:controlchanger}" @click="refuse"  v-if="beoverdue== true">
					<div class='an-head-tile'>
						<div class='title' >不接受</div>
					</div>			
				</view>
			</view>
			
			
			<view class="tCenter f14 col_999 pT5" v-if="!controlchanger">
				如有随同人员，请将本邀请函分享给他 <br/> 进行资料填写
				
			</view>
			<view class="an-index-box box-color2" style="margin:0 auto;" @click="goanswer()" v-if="usershowtext=='请进行相关答题'">
				<div class='an-head-tile'>
					<div class='title' >去答题</div>
				</div>			
			</view>
			<view class="tCenter f16" v-if="controlchanger">
				 <view class="f16" v-html="usershowtext"></view>
			</view>
		</view>
		
		
		<!-- 我的邀请 -->
		<view class="second pB50" style="margin-top:30px;" v-if="isloginstate&&mycontrolchanger">
			<view class="an-index-grid" >
				<view class="an-index-box box-color3"  v-if="appointmentinfo.meeting_status!=1&&appointmentinfo.status == 0 & beoverdue== true ||appointmentinfo.appointment_details.meeting_status!=1&&appointmentinfo.status == 4 &beoverdue== true"  @click="openpause(appointmentinfo,index)">
					<div class='an-head-tile'>
						<div class='title'>{{appointmentinfo.status == 4?'启用':'暂停'}}</div>
					</div>
				</view>
				
				<view class="an-index-box box-color2" :class="{control:pasecontrolchanger}" v-if="appointmentinfo.appointment_details.meeting_status==0 & beoverdue== true" @click="showshare()">
					<div class='an-head-tile'>
						<div class='title'>分享</div>
					</div>
				</view>
				<view class="an-index-box box-color5" :class="{control:pasecontrolchanger}"  @click="modifymy()" v-if="appointmentinfo.status == 0&&appointmentinfo.appointment_details.meeting_status==0">
					<div class='an-head-tile'>
						<div class='title' >修改</div>
					</div>			
				</view>
				<view class="an-index-box box-color1" :class="{control:pasecontrolchanger}"  @click="del()" v-if="appointmentinfo.status == 0&&appointmentinfo.appointment_details.meeting_status==0">
					<div class='an-head-tile'>
						<div class='title' >删除</div>
					</div>			
				</view>
			</view>
		</view>
		<view class="mT10">
			<view class="an-index-grid" v-if="!isloginstate&& !subscribe" style="justify-content: space-evenly;">
				<view class="an-index-box box-color3news" style="height: 40px;line-height: 40px;">
					<div class='an-head-tile' style='line-height: unset;' @click="gologinshow">
						<div class='title' >去注册</div>
					</div>							
				</view>
			</view>
		</view>
		<view class="mT10">
			<view  class="an-index-grid" v-if="!isloginstate&&subscribe" style="justify-content: space-evenly;">
				<view class="an-index-box box-color3news" style="height: 40px;line-height: 40px;">
					<div class='an-head-tile' style='line-height: unset;' @click="gologingz">
						<div class='title' >去关注</div>
					</div>							
				</view>
			</view>
		</view>
		<!-- 底部导航 -->
		<footernav pagePath='myyuyue' v-if="isloginstate&&controlchanger||mycontrolchanger"></footernav>
		<!-- 加载动画 -->
		<loading v-if="!isloading()"></loading>
		<!-- <backhome></backhome> -->
		<view class="w100 tRight sharewindow" v-if="sharein" @click="hideshare()">
			<img class="w60 pR10" src="../../static/img/share.png" ></img>
		</view>
	</view>
</template>
<script module="demo" lang="renderjs">
	 export default {
		 methods: {
			 previewImg(logourl) {
			 
			 	if(logourl){
			 		let _this = this;
			 		let imgsArray = [];
			 		imgsArray[0] = logourl
			 		uni.previewImage({
			 			current: 0,
			 			urls: imgsArray
			 		});
			 	}
			 },
			submitmodify:function(event, ownerInstance){			
				
				 if(document.getElementsByClassName("fangcarnumbers").length>0){
					 var vale=document.getElementsByClassName("fangcarnumbers")[0].childNodes[0].childNodes[1]._value;
					 ownerInstance.callMethod('modify',vale);
				 }else{
					 var vale='';
					ownerInstance.callMethod('modify',vale); 
				 }
				  
			 },
			 submitadds:function(event, ownerInstance){
			 
			 	if(document.getElementsByClassName("fangcarnumbers").length>0){
					var vale=document.getElementsByClassName("fangcarnumbers")[0].childNodes[0].childNodes[1]._value;
			 		ownerInstance.callMethod('acceptadd',vale);
			 	}else{
					 var vale='';
					ownerInstance.callMethod('acceptadd',vale); 
			 	}
				
			 	  
			  },
		},
	}
</script>
<script>
import { mapState, mapMutations } from 'vuex';
import mInput from '@/components/m-input.vue';
import { hostRoot, img } from '@/common/util.js';
import request from '../../common/vmeitime-http/requstx.js'; //引进requst方法
import defaultImg from '@/static/img/userImg.jpg';
import {appointmentinfo,appointmentaccept,appointmentrefuse,appointmentdelete,appointmentstate,appointmentltime} from '../../common/api/appointment.js';
import {userinfo} from '@/common/api/user.js'
import backhome from '@/components/backhome.vue';
import uniIcons from '@/components/uni-icons/uni-icons.vue';
import {wexinshare} from '@/common/wechatshare.js';
// #ifdef H5 
var jweixin = require('@/components/jweixin-module/index.js');
// #endif
export default {
	components: {
		backhome,
		mInput,
		uniIcons
	},
	data() {
		return {
			radiostate:'',
			carnumber:'',
			footerShow:false,
			sharein:false,
			appointmentinfo:[],
			userSrc: '',
			userSrcnews: '',
			grids: [],
			user_name: '',
			company: '',
			visittime: '',
			visittime2: '',
			reson: '',
			remark: '',
			mobile: '',
			address: '',
			id: '',
			appId: '',
			timestamp: '',
			timestamp2: '33234',
			nonceStr: '',
			signature: '',
			userinfodata:'',
			controlchanger:true,
			pasecontrolchanger:true,
			controlchangerall:true,
			isloginstate:true,
			tips:'',
			registerstate:'',
			showmessage:'',
			ismyfangxiang:false,
			mycontrolchanger:false,
			usershowtext:'',
			showclick:true,
			time_streamlist:[],
			subscribe:'',
			identitycard:'',
			detaildata:[],
			beoverdue:true,
			
		};
	},

	onLoad(event) {		
		try {
			this.banner = JSON.parse(decodeURIComponent(event.detailDate));
			console.log(this.banner);
		} catch (error) {
			this.banner = JSON.parse(event.detailDate);
			console.log(this.banner);
		}
		this.id = this.banner.id;
		
		
		uni.getStorage({
			key: 'headimgurl',
			success: res => {
				console.log(res.data);
				this.userSrc = res.data;
				this.subscribe = res.data.subscribe;
				console.log(this.subscribe);
				console.log(this.userSrc);
			}
		});
		let that=this;
		appointmentinfo({id:this.banner.id,appointmentid:this.banner.id}).then(res=>{
			if(res.data.code==400){
				// uni.showToast({
				// 	title: res.data.message,
				// 	icon: 'none',
				// 	duration: 2000
				// });
				uni.showModal({
				    title: '',
				    content: res.data.message,						
					showCancel:false,
					confirmText: "确定",
				    success: function (res) {
				        if (res.confirm) {
				            console.log('用户点击确定');
							if(that.showlogin()){
								uni.reLaunch({
									url: "/pages/myyuyue/myyuyue?type=2"
								});	
							}else{
								that.goshouji(this.registerstate);
							}
							
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				});
			}
			this.appointmentinfo = res.data.data
			console.log("注册方式"+that.appointmentinfo.appointment_details.is_completeperson)
			this.user_name = res.data.code;
			this.company = res.data.data.uname;
			this.visittime = res.data.data.visittime;
			this.visittime2 = res.data.data.endvisittime;
			this.detaildata=res.data.data;
			this.reson = res.data.data.reson;
			this.remark = res.data.data.remark;
			this.mobile = res.data.data.mobile;
			this.address = res.data.data.company_name;
			this.userSrc = res.data.data.headimgurl;
			this.userSrcnews = res.data.data.personimg;
			if(res.data.data.time_stream){
				console.log(res.data.data.time_stream)
				this.time_streamlist=res.data.data.time_stream;
			}
			
		
			uni.getStorage({
				key: 'token',
				success: (res) => {
					console.log(res.data);
					that.token = res.data;
					}
			});		
			if(this.detaildata.appointment_details.m_status == 7 && this.detaildata.appointment_details.m_tips == "待访问" || this.detaildata.appointment_details.m_status == 13 && this.detaildata.appointment_details.m_tips == "访客答题中"){
			appointmentltime({'token':that.token,'mid':this.mid}).then(res=>{
					console.log(res)
				});
			}	
			if(that.islogin()){
				userinfo({}).then(res=>{
					if(that.appointmentinfo.uid == res.data.data.id){
						that.mycontrolchanger = true;
						that.tips = '该邀请属于自己';
						uni.setNavigationBarTitle({
						　　title:'邀请函详情'
						})
					}
					
					that.userinfodata = res.data.data;
					
					that.identitycard =  res.data.data.identitycard;
					console.log('身份证'+that.identitycard)
					if(that.appointmentinfo.appointment_details){
							if(that.appointmentinfo.appointment_details.vister_uid==res.data.data.id){
								that.ismyfangxiang=true;
							}else{
								that.ismyfangxiang=false;
							}
					}
					
					this.shareing();
					
				})
			}
			let time = new Date();
			let nowyear = time.getFullYear();
			let nowmonth = Number(time.getMonth()) + 1;
			let nowday = time.getDate();		
			let nowmin = time.getHours();
			let nowse=time.getMinutes();
			let endvisittime = that.visittime2;
			console.log(nowyear,nowmonth,nowday,nowmin,nowse);
			console.log(endvisittime)
			let year = endvisittime.slice(0,4);
			let month = endvisittime .slice(5,7);
			if(month<10){
				month = month.slice(1,2);
			}
			let day = endvisittime.slice(8,10);
			if(day<10){
				day = day.slice(1,2);
			}
			let min = endvisittime.slice(11,13);
			if(min<10){
				min = min.slice(1,2);
			}
			let se = endvisittime.slice(14,16);
			if(se<10){
				se = se.slice(1,2);
			}
			console.log(year,month,day,min,se);
			// alert(that.detaildata.appointment_details.m_tips);
			if(nowyear==year & nowmonth==month & nowday==day &that.detaildata.appointment_details.m_status == 0){
				if(nowmin == min){
						if(nowse >= se){
							console.log("a");
							that.beoverdue = false;
							uni.showModal({
							    title: '',
							    content: '该邀请已过期\n如需接受邀请，请修改到访时间\n',						
								showCancel:false,
								confirmText: "确定",
							    success: function (res) {
							        if (res.confirm) {
							            console.log('用户点击确定');
							        } else if (res.cancel) {
							        
							        }
							    }
							});
						}else{
							return
						}
					}	
					else if(nowmin > min){
							console.log("a");
							that.beoverdue = false;
							uni.showModal({
							    title: '',
							    content: '该邀请已过期\n如需接受邀请，请修改到访时间\n',						
								showCancel:false,
								confirmText: "确定",
							    success: function (res) {
							        if (res.confirm) {
							            console.log('用户点击确定');
							        } else if (res.cancel) {
							        
							        }
							    }
							});
					}	
			else{
					
				}
			}else if(nowyear>year & that.detaildata.appointment_details.m_status == 0|| nowmonth>month  &that.detaildata.appointment_details.m_status == 0 || nowday>day &that.detaildata.appointment_details.m_status == 0){
				that.beoverdue = false;
				console.log("b");
				uni.showModal({
				    title: '',
				    content: '该邀请已过期\n如要邀请，请修改到访时间\n',						
					showCancel:false,
					confirmText: "确定",
				    success: function (res) {
				        if (res.confirm) {
				            console.log('用户点击确定');
				        } else if (res.cancel) {
				        
				        }
				    }
				});
			
			}else{
				
			}
			if(this.appointmentinfo.status==4){
				this.pasecontrolchanger=true;
			}else{
				this.pasecontrolchanger =false;
			}
			
			if(this.appointmentinfo.is_completeperson=='1'){
				this.registerstate='1'
			}
			if(!this.islogin()){
				this.controlchanger = true;
				this.isloginstate=false;
			}else if(this.appointmentinfo.appointment_details.m_status==0){
				this.controlchanger = false;
			}else if(this.appointmentinfo.appointment_details.m_status==1){
				// var text='您正在访问...';
				var text='您已完成本次来访<br>如需再访，请重新联系受访人。';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==2){
				var text='本次操作已逾期<br>如需到访，请重新联系受访人。';				
				this.controlchanger = true;
				this.usershowtext=text;
				return;
				
			}else if(this.appointmentinfo.appointment_details.m_status==3){
				var text='本次操作已逾期<br>如需到访，请重新联系受访人。';				
				this.controlchanger = true;
				this.usershowtext=text;
				return;
				
			}else if(this.appointmentinfo.appointment_details.m_status==4){
				var text='受访人暂停本次邀请<br>请重新联系！';				
				this.controlchanger = true;
				this.usershowtext=text;
				return;
				
			}else if(this.appointmentinfo.appointment_details.m_status==5){
				var text='您不接受本次邀请<br>如需到访，请重新联系受访人';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==6){
				// var text='您已经接受本次邀请<br>请如期安排。';
				var text='您已经接受邀请<br>请等待受访人确认';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==7){
			    var text='您已接受本次邀请<br>请如期安排。';
				// var text='您已经接受邀请<br>请等待受访人确认';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==8){
				var text='您的修改已发送给受访人<br>请等待确认';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==9){
				var text='受访人不接受本次邀请<br>请重新联系！';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==10){
				var text='您的修改已发送给受访人<br>请等待确认';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==11){
				var text='您已经接受邀请<br>请等待受访人确认';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==13){
				var text='请进行相关答题';
				this.controlchanger = true;
				this.usershowtext=text;
				return;
			}
			
			
		})
		
	},

	
	onShow() {
		let _this=this;
		var subscribe=sessionStorage.getItem("subscribe");
		if (subscribe) {
			_this.subscribe='YES'
		}else{
			_this.subscribe=''
		}
		
		// console.log(this.islogin())
		
		
		// request({
		// 	url: 'appointment/info',
		// 	method: 'GET',
		// 	data: {
		// 		id: this.banner.id
		// 	},
		// 	success: res => {
				

		// 		if (res.data.message == 'token已过期') {
		// 			uni.showToast({
		// 				title: res.data.message,
		// 				icon: 'none',
		// 				duration: 2000
		// 			});
		// 			window.location.href = this.weixinhttpurl+'/#/pages/shouquan/shouquan';
		// 		} else if (res.data.message == 'token不存在') {
		// 			uni.showToast({
		// 				title: res.data.message,
		// 				icon: 'none',
		// 				duration: 2000
		// 			});
		// 			window.location.href = this.weixinhttpurl+'/#/pages/shouquan/shouquan';
		// 		} else if (res.data.message == '用户不存在') {
		// 			uni.showToast({
		// 				title: res.data.message,
		// 				icon: 'none',
		// 				duration: 2000
		// 			});
		// 			window.location.href = this.weixinhttpurl+'/#/pages/shouquan/shouquan';
		// 		} else {
		// 			this.user_name = res.data.code;
		// 			this.company = res.data.data.uname;
		// 			this.visittime = res.data.data.visittime;
		// 			this.reson = res.data.data.reson;
		// 			this.remark = res.data.data.remark;
		// 			this.mobile = res.data.data.mobile;
		// 			this.address = res.data.data.address;
		// 		}
		// 	}
		// });

		
	},
	methods: {
		showcarnumber(){
			this.carnumber=this.carnumber;
		},
		chooseradio(type){
			this.radiostate='';
			this.radiostate=type;
			console.log(this.radiostate)
		},
		showuserdata(){
		
		},
		shareing(){
			let username=uni.getStorageSync('username');
			var title="访客邀请函";
			let desccontent=this.appointmentinfo.company_name+this.appointmentinfo.uname+"邀请您";
			// let desccontent=this.visittime+"邀请您来"+this.appointmentinfo.company_name+this.appointmentinfo.appointment_details.address+'进行'+this.appointmentinfo.reson +'&sharecode='+this.userinfodata.sharecode;
			var url=this.weixinhttpurl+'/#/pages/yaoqing/fangxiang?detailDate=' + encodeURIComponent(JSON.stringify(this.appointmentinfo));
			// var img='https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2267186809,1206764244&fm=26&gp=0.jpg';
			var sharedata={
				title:title,
				desc:desccontent,
				img:this.sharehttpurl+'/static/images/shareimg.jpg?123',
				link:url
			}
			
			wexinshare(sharedata)//微信分享
		},
		hideshare(){
			this.sharein=false;
		},
		showdata(){
			
		},
		gologinshow(){
			this.goshouji(this.registerstate);								
		},
		gologingz(){
				//迎客舟
				var href = 'https://mp.weixin.qq.com/s/jopUdv6ICw6uxN3XB_3Wnw'; 
				//智服网	
				// var href = 'https://mp.weixin.qq.com/s/kc64hSEoH7YCOHfDSY50Ng';			
				localStorage.setItem('restype',this.registerstate)
				window.location.replace(href)						
		},
		showshare(){
			if(this.appointmentinfo.status==4){
				uni.showToast({
					title:  '您已暂停本次邀请',
					duration: 2000,
					icon:'none'
				});
				return;
				
			}else{
				uni.showToast({
					title:  '点击右上角进行分享',
					duration: 2000,
					icon:'none'
				});
				this.sharein=true;	
			}
			
		},
		
		showismy(msg){
				if(this.ismyfangxiang){
					var text=msg;
					uni.showModal({
						title: '',
						content: text,						
						showCancel:false,
						confirmText: "确定",
						success: function (res) {
							if (res.confirm) {
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
					return;
				}else{
					var text='本次邀请已被接受，请联系。';
					uni.showModal({
						title: '',
						content: text,						
						showCancel:false,
						confirmText: "确定",
						success: function (res) {
							if (res.confirm) {
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
					return;
				}
		},
		
		btnstatus(){
			var text='';
			 
			// if(this.appointmentinfo.status==1){
			// 	// var text='您正在访问...';
			// 	var text='您已完成本次来访<br>如需再访，请重新联系受访人。';
			// 	this.showismy(text);
			// 	return;
			// }else if(this.appointmentinfo.status==3){
			// 	var text='您已完成本次来访<br>如需再访，请重新联系受访人。';
			// 	this.showismy(text);
			// 	return;
			// }
			// else if(this.appointmentinfo.status==2){
			// 	var text='本次操作已逾期<br>如需到访，请重新联系受访人。';				
			// 	this.showismy(text);
			// 	return;
				
			// }else if(this.appointmentinfo.status==4){
			// 	var text='受访人暂停本次邀请<br>请重新联系！';
			// 	this.showismy(text);
				
			// 	return;
				
			// }else if(this.appointmentinfo.auditing==0){
			// 	var text='您的修改已发送给受访人，\r\n请等待确认';				
			// 	this.showismy(text);
			// 	return;
				
			// }else if(this.appointmentinfo.auditing==2){
			// 	var text='您的修改受访人未能通过，\r\n请重新联系受访人。';				
			// 	this.showismy(text);
			// 	return;
				
			// }else if(this.appointmentinfo.auditing==3){
			// 	var text='您的修改已发送给受访人，\r\n请等待确认';				
			// 	this.showismy(text);
			// 	return;
				
			// }else if(this.appointmentinfo.appointment_details.meeting_status==2){
			// 	var text='您已经接受本次邀请<br>请如期安排。';
			// 	this.showismy(text);
			// 	return;
			// }else if(this.appointmentinfo.appointment_details.meeting_status==1){
			// 	var text='您不接受本次邀请<br>如需到访，请重新联系受访人';
			// 	this.showismy(text);
			// 	return;
			// }
			if(this.appointmentinfo.appointment_details.m_status==1){
				// var text='您正在访问...';
				var text='您已完成本次来访\r\n如需再访，请重新联系受访人。';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==2){
				var text='本次操作已逾期\r\n如需到访，请重新联系受访人。';				
				
				this.showismy(text);
				return;
				
			}else if(this.appointmentinfo.appointment_details.m_status==3){
				var text='本次操作已逾期\r\n如需到访，请重新联系受访人。';				
				
				this.showismy(text);
				return;
				
			}else if(this.appointmentinfo.appointment_details.m_status==4){
				var text='受访人暂停本次邀请\r\n请重新联系！';				
				
				this.showismy(text);
				return;
				
			}else if(this.appointmentinfo.appointment_details.m_status==5){
				var text='您不接受本次邀请\r\n如需到访，请重新联系受访人';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==6){
				var text='您已经接受邀请\r\n请等待受访人确认';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==7){
				var text='您已经接受邀请\r\n请等待受访人确认';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==8){
				var text='您的修改已发送给受访人\r\n请等待确认';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==9){
				var text='受访人不接受本次邀请\r\n请重新联系！';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==10){
				var text='您的修改已发送给受访人\r\n请等待确认';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==11){
				var text='您已经接受邀请\r\n请等待受访人确认';
				
				this.showismy(text);
				return;
			}else if(this.appointmentinfo.appointment_details.m_status==13){
				var text='请进行相关答题';
				
				this.showismy(text);
				return;
			}else{
				if(this.showmessage){
					this.usershowtext=text.replace('\r\n','<br>');
					uni.showModal({
						title: '',
						content: this.showmessage,						
						showCancel:false,
						confirmText: "确定",
						success: function (res) {
							if (res.confirm) {
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				}
				
				return true;
			}
			
			
		},
		refreshondata(){
			appointmentinfo({id:this.banner.id,appointmentid:this.banner.id}).then(res=>{
				if( res.data.data.auditing==1){
					this.controlchanger = false;
				}
			})
		},
		acceptadd(val){
			this.carnumber=val;
			let that=this;
			if(this.isgologin()&&this.btnstatus()){	
			
			if(that.appointmentinfo.appointment_details.is_completeperson == 2 && !that.identitycard){
				uni.showModal({
					title: '',
					content: '您还没实名认证\r\n请实名认证后再操作',						
					
					buttonText: '去认证',
					confirmText: "去认证",
					success: function (res) {
						if (res.confirm) {
							uni.navigateTo({
							    url: '../shouquan/shengfen',
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
				return;
			}
				
				
			if (this.radiostate == '') {
				uni.showToast({
					icon: 'none',
					title: '请填写车牌号码'
				});
				return;
			}
			if (this.radiostate=='2'&&this.carnumber=='') {
				uni.showToast({
					icon: 'none',
					title: '请填写车牌号码'
				});
				return;
			}
			if (this.radiostate=='2'&&this.carnumber.length<7||this.radiostate=='2'&&this.carnumber.length>8) {
				uni.showToast({
					icon: 'none',
					title: '请填写正确的车牌号码'
				});
				return;
			}
			if(this.controlchanger){
				if(this.tips!=''){					
					uni.showModal({
						title: '',
						content: this.tips,						
						showCancel:false,
						confirmText: "确定",
						success: function (res) {
							if (res.confirm) {
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				}
				return;
				}
			if(this.showclick){
				uni.showLoading({
				    title: '正在进行相关操作...'  
				});
				this.showclick=false;
				appointmentaccept({id:this.banner.id,appointmentid:this.banner.id,"carnumber":this.carnumber}).then(res=>{
					this.showclick=true;
					uni.hideLoading();
					 
					uni.showModal({
						title: '',
						content: res.data.message,						
						showCancel:false,
						confirmText: "确定",
						success: function (rese) {
							if (rese.confirm) {
							if(res.data.code==400){
								that.showmessage=res.data.message;
								that.usershowtext=res.data.message;
								that.controlchanger = true;
								return;
							}
							if(res.data.data.is_question==1){
								uni.reLaunch({
									url: "/pages/myyuyue/myyuyue?type=2"
								});	
								return;
							}else{
								setTimeout(()=>{
									let details = {
										companyid:that.appointmentinfo.companyid,
										appointmentid:that.appointmentinfo.id,
										type:'yq'						
									}
									uni.reLaunch({
										// url: "/pages/myyuyue/myyuyue"
										url:"/pages/subject/problem?details="+encodeURIComponent(JSON.stringify(details))
									});		
								},300)		
							}
							} else if (rese.cancel) {
								console.log('用户点击取消');
							}
						}
					});
					that.refreshondata();
					
					
				})
			}	
			
			}
		},
		modify(val){
			this.carnumber=val;
			let that=this;
			if(this.isgologin()&&this.btnstatus()){
				if(that.appointmentinfo.appointment_details.is_completeperson == 2 && !that.identitycard){
					uni.showModal({
						title: '',
						content: '您还没实名认证\r\n请实名认证后再操作',						
						buttonText: '去认证',
						confirmText: "去认证",
						success: function (res) {
							if (res.confirm) {
								uni.navigateTo({
								    url: '../shouquan/shengfen',
								});
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
					return;
				}
				// if (this.radiostate == '') {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: '请选择到车牌号码类型'
				// 	});
				// 	return;
				// }
				
				// if (this.radiostate=='2'&&this.carnumber=='') {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: '请填写车牌号码'
				// 	});
				// 	return;
				// }
			if(this.controlchanger){
// 				window.addEventListener( "focusout", () => {
//             //软键盘收起的事件处理
//             MonitoringSoftKeyboard.FocusinHandler(() => {
//               this.footerShow = true;
//             });
//         },false);
				if(this.tips!=''){
					uni.showModal({
						title: '',
						content: this.tips,						
						showCancel:false,
						confirmText: "确定",
						success: function (res) {
							if (res.confirm) {
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				}
				return;
			}
			
			// this.banner.id 
			let details = {
				id:this.banner.id,
				carnumber:this.carnumber,
				radiostate:this.radiostate,
				type:'yq'						
			}
			uni.navigateTo({
				url: '/pages/yaoqing/invitationModification?detailDate='+encodeURIComponent(JSON.stringify(details)),
				
			});
			}
		},
		refuse(){
			if(this.isgologin()&&this.btnstatus()){
			if(this.controlchanger){
				if(this.tips!=''){
					uni.showModal({
						title: '',
						content: this.tips,						
						showCancel:false,
						confirmText: "确定",
						success: function (res) {
							if (res.confirm) {
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				}
				return;
				}
			uni.navigateTo({
				url: '/pages/yaoqing/invitationRefuse?id='+this.banner.id+'&shownav=NO',
			});
			}
		},
		goanswer(){
			let details = {
				companyid:this.appointmentinfo.companyid,
				appointmentid:this.appointmentinfo.id,
				type:'yq'						
			}
			uni.reLaunch({
				// url: "/pages/myyuyue/myyuyue"
				url:"/pages/subject/problem?details="+encodeURIComponent(JSON.stringify(details))
			});	
		},
		openpause(item){
			if(item.status==4){
				var text='启用';
				var state='0';
			}else{
				var text='暂停';					
				var state='4';
			}
			
			let  _that = this
			uni.showModal({
			    title: '确定'+text+'此邀请?',
			    success: function (res) {
			        if (res.confirm) {							
						appointmentstate({id:item.id,state:state}).then(res=>{
							if(res.data.code==200){
								uni.showToast({
								    title:res.data.message,
								    duration: 2000
								});
								 _that.page=1;
								 _that.showdata()
							}
						})
			            // console.log('用户点击确定');
			        } else if (res.cancel) {
						return 
			            // console.log('用户点击取消');
			        }
			    }
			});
		},
		modifymy(index){
			uni.navigateTo({
				url: './invitationModification'+'?detailDate='+JSON.stringify(this.appointmentinfo)
			});
		},
		del(id){			
			/*请求*/
			let  _that = this
			uni.showModal({
			    title: '确定删除此邀请?',
			    success: function (res) {
			        if (res.confirm) {
						appointmentdelete({'id':this.appointmentinfo.id}).then(res=>{
							if(res.data.code==200){
								uni.showToast({
								    title: '成功删除',
								    duration: 2000
								});
								uni.reLaunch({
									url:"/pages/yaoqing/yaoqinglist",
								});	
							}
						})
			            // console.log('用户点击确定');
			        } else if (res.cancel) {
						return 
			            // console.log('用户点击取消');
			        }
			    }
			});
		
			
		},
	}
};
</script>

<style lang="scss">
	.none{
		display: none;
	}
	.details-message {
		width: 95%;
		margin: auto;
		uni-view {
			margin: 0px 0;
			padding: 10px;
			background-color: #fff;
			border-bottom: 1px solid #eee;
		}
	}
.an-index {
	// padding: 15px 0px;
	background-color: #efeff4;
	// background: #fefefe url(../../static/img/head_bg.png) no-repeat;
	background-size: 100% auto;
}

.an-head-nav {
	padding: 40upx 0;
	display: flex;
	flex-direction: row;
	justify-content: space-between;

	.title {
		font-size: 18px;
		padding-left: 10px;
	}

	.btn {
		font-size: 18px;
		padding: 0 8px;
	}
}
.content {
	display: flex;
	flex: 1;
	flex-direction: column;
	
}

.swiper-item {
	height: 100%;
}

.an-index-grid {
	display: flex;
	flex-direction: row; //主轴方向
	flex-wrap: wrap; //换行
	// justify-content: space-between; //主轴上的对齐方式
	justify-content:center; //主轴上的对齐方式
	width: 90%;
	    margin: auto;
}

.an-index-box {
	// flex: 0 1 22%; //flex-grow, flex-shrink 和 flex-basis的简写
	//flex-grow: 0;	//等分剩余空间
	//flex-shrink: 1;	//等比例缩小
	//flex-basis: 48%;	//占据的主轴空间
	height: 32px;
	line-height: initial;
	width: 140upx;
	margin: 0 5px;
	color: #ffffff;
	margin-bottom: 20px;
	border-radius: 10px;
	
	box-shadow: 0px 10px 8px #e8e8e8;

	.an-head-tile {
		//交叉轴对齐方式
		text-align: center;
		    line-height: 32px;
	}
}

.an-body-cont {
	margin-top: 5px;
}

.box-color2 {
	background: linear-gradient(to bottom right, #009688, #009688);
}

.box-color3 {
	background: #007aff;
}
.box-color3news {
	background: #007aff;
	    flex: 0 1 80%;
}

.box-color1 {
	background: red;
}
.box-color5 {
	background-color: rgba(230, 162, 60, 1);
}

.jin {
	position: relative;
}

.jin-frist {
	background: #bebebe;
	// position: absolute;
	margin: auto;
	top: 0;
	right: 0;
	left: 0;
	color: white;
	text-align: center;
	width: 80px;
	height: 80px;
	border-radius: 80px;
	box-shadow: 0px 10px 8px #e8e8e8;
}

.title-first {
	font-size: 17px;
	margin-top: 50px;
}

.title-first1 {
	font-size: 17px;
	margin-top: 5px;
}

.qiun-charts {
	width: 100%;
	height: 500upx;
	background-color: #ffffff;
}

.charts {
	width: 100%;
	height: 500upx;
	background-color: #ffffff;
}
.control{
	background:#5f5f5f;
}
</style>
<style>
	body{
		background: white;
	}
.yaoqing {
	margin-top: 20px;
	text-align: center;
}
.sharewindow{position:fixed;z-index: 999; top: 0px;right: 0;height: 100%;background-color: rgba(0,0,0,0.4);}
</style>
